# Copyright (c) 2024, lanlian and contributors
# For license information, please see license.txt

import frappe
from frappe.model.document import Document


class EMSCardChange(Document):
	def on_submit(self):
		if self.new_location:
			frappe.db.set_value('EMS Equipment Card', self.equipment_number, {'location': self.new_location})
		if self.new_user_department:
			frappe.db.set_value('EMS Equipment Card', self.equipment_number, {'user_department': self.new_user_department})
		if self.new_service_life:
			frappe.db.set_value('EMS Equipment Card', self.equipment_number, {'service_life': self.new_service_life})
